///////////////////////////////////////////////////////////
//  StringData.cpp
//  Implementation of the Class StringData
//  Created on:      19-Aug-2013 10:16:20 PM
//  Original author: Jakkaphan Aiemcharoenjit
///////////////////////////////////////////////////////////

#include "StringData.h"
#include "DataSchemaXML.h"
using namespace Data;


StringData::StringData(const String_t& _value)
{
  this->m_type = IObject::DATA_T;
  this->m_dataType = IData::STRING_T;
  this->m_value = _value;
}


StringData::StringData(const StringData& anotherString)
{
  this->m_type = IObject::DATA_T;
  this->m_dataType = IData::STRING_T;
  this->m_value = anotherString.m_value;
}


StringData::~StringData()
{

}


IData::DataType StringData::GetDataType() const 
{

	return this->m_dataType;
}


IObject::ObjectType StringData::GetType() const 
{

	return this->m_type;
}


String_t StringData::GetValue() const 
{

	return  this->m_value;
}


void StringData::SetValue(const String_t& _value)
{
  this->m_value = _value;
}


IObject* StringData::Clone()
{
  StringData* cloneData = new StringData(*this);
	return cloneData;
}


String_t StringData::ToString() const 
{
	//return L"value = " + this->m_value + L"\n" ;
  return this->m_value;
}


String_t StringData::ToXML()
{
  //<UseString>This is an example value.</UseString>
  String_t context = this->m_value;
  replaceTextXML(context);
  String_t xml = _T("<") + DataSchemaXML::STRINGDATA_ELEMENT + _T(">") + context + _T("</") + DataSchemaXML::STRINGDATA_ELEMENT + _T(">");
	return xml;
}